package com.hub.realtime.common.enums;

import java.io.Serializable;
import java.util.Arrays;

/**
 *
 */
public enum JobDeployState implements Serializable {

    /**
     * 需用重新发布,但是下载maven依赖失败.(针对flinkSql任务)
     */
    FAILED(-1),
    /**
     * 完结
     */
    DONE(0),

    /**
     * 正在部署中
     */
    DEPLOYING(1),

    /**
     * 需要重新发布
     */
    NEED_DEPLOY(2);


    int value;

    JobDeployState(int value) {
        this.value = value;
    }

    public int get() {
        return this.value;
    }

    public static JobDeployState of(Integer state) {
        return Arrays.stream(values()).filter((x) -> x.value == state).findFirst().orElse(null);
    }
}
